﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="AddCleanPlan.ascx.vb"
    Inherits="WebForm_ManageWorkRecord_AddCleanPlan" %>
<%@ Register Src="AddLeader.ascx" TagName="AddLeader" TagPrefix="My" %>
<%@ Register Src="~/WebForm/AddControl/AddWorkHeaderControl.ascx" TagName="AddWorkHeaderControl"
    TagPrefix="My" %>
<%--<%@ Register Src="~/WebForm/AddControl/AddWorkItemControl.ascx" TagName="AddWorkItemControl"
    TagPrefix="My" %>--%>
<%--<%@ Register Src="~/WebForm/SearchControl/SearchCleanPlanControl.ascx" TagName="SearchCleanPlanControl"
    TagPrefix="My" %>--%>
<%@ Register Src="~/WebForm/ManageWorkContent/vSelfRegionType.ascx" TagName="SelfRegionType"
    TagPrefix="My" %>
<%@ Register Src="~/WebForm/CommonControl/UploadFileControl.ascx" TagName="UploadFileControl"
    TagPrefix="uc2" %>
<%@ Register Src="../CommonControl/VolunteerQueryControl.ascx" TagName="VolunteerQueryControl"
    TagPrefix="uc4" %>
<%@ Register Src="SearchVolunteerControl_AddCleanPlan.ascx" TagName="SearchVolunteerControl_AddCleanPlan"
    TagPrefix="uc1" %>
<%@ Reference Control="~/WebForm/CommonControl/CalendarTextBox.ascx" %>
<%@ Reference Control="~/WebForm/AddControl/SelectTime.ascx" %>
<%@ Reference Control="~/WebForm/ManageWorkContent/vSelfRegionType.ascx" %>

<script>
Sys.Application.add_load(
 function(sender, eventArgs) {

	$('input[name*="chkAllSignIn"],input[name*="chkAllSignIn"]').click(function(){
		$('input[name*="chkSignIn"]').attr('checked', this.checked);
	});

	$('input[name*="chkAllSignOut"],input[name*="chkAllSignOut"]').click(function(){
		$('input[name*="chkSignOut"]').attr('checked', this.checked);
	});
	
    $('input[name*="chkAlldelete"],input[name*="chkAlldelete"]').click(function(){
		$('input[name*="chkdelete"]').attr('checked', this.checked);
	});

});
</script>
   
<table width="100%" cellpadding="0" cellspacing="0">
    <tr>
        <td class="Section">
            <asp:Label ID="lblCleanPlanInfo1" runat="server" meta:resourcekey="lblCleanPlanInfo1"></asp:Label>
        </td>
    </tr>
    <tr>
        <td>
            <table width="100%">
                <tr>
                    <td align="right">
                        <asp:Label ID="lblPlanName" runat="server" meta:resourcekey="lblPlanName"></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtPlanName" runat="server" Enabled="false" Width="325px"></asp:TextBox>
                    </td>
                    <td align="right">
                        <asp:Button ID="btnExport" runat="server" Text="<%$ Resources:Export %>" ValidationGroup="Export" />
                        <asp:Button ID="btnUploadFile" runat="server" Text="<%$ Resources:UploadFile %>"
                            ValidationGroup="Export" />
                        <asp:PlaceHolder ID="plButtonList" runat="server">
                            <asp:Button ID="btnSave" runat="server" Text="<%$ Resources:Save %>" ValidationGroup="AddWorkHeaderA" />
                            <asp:Button ID="btnApprove" runat="server" Text="<%$ Resources:Approve %>" ValidationGroup="AddWorkHeaderA" />
                         <%--   <ajaxToolkit:ConfirmButtonExtender ID="ceApprove" runat="server" TargetControlID="btnApprove"
                                meta:resourcekey="ceApprove">
                            </ajaxToolkit:ConfirmButtonExtender>--%>
                        </asp:PlaceHolder>
<%--                        <My:SearchCleanPlanControl ID="SearchCleanPlanControl1" runat="server" />
--%>                        <uc2:UploadFileControl ID="UploadFileControl1" runat="server" isEdit="True" strClass="AddCleanPlan" />
                    </td>
                </tr>
            </table>
            <hr />
            <table>
                <tr>
                    <td>
                        <asp:FormView ID="fv" runat="server" DefaultMode="Insert" OnDataBound="fv_DataBound"
                            Width="100%" DataKeyNames="PlanID" Enabled="False">
                            <EditItemTemplate>
                                <table>
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="lblPlanName" runat="server" meta:resourcekey="lblPlanName"></asp:Label>
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtPlanName" runat="server" MaxLength="50" Text='<%#Bind("PlanName") %>'
                                                Enabled="false"></asp:TextBox>
                                            <asp:CheckBox ID="chkPublic" runat="server" meta:resourcekey="chkPublic" />    
                                        </td>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPlanName"
                                            Display="None" meta:resourcekey="rfvPlanName" SetFocusOnError="True" ValidationGroup="vInsert"></asp:RequiredFieldValidator>
                                        <td align="right">
                                            <asp:Label ID="lblOrganizationID" runat="server" meta:resourcekey="lblOrganizationIDInfo"></asp:Label>
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtOrganizationName" runat="server" Text='<%#Bind("OrganizationName") %>'
                                                Enabled="false"></asp:TextBox>
                                            <asp:TextBox ID="txtOrganizationID" runat="server" Visible="false" Text='<%#Bind("UOrganizationID") %>'></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="lblPersonInCharge" runat="server" meta:resourcekey="lblPersonInCharge"></asp:Label>
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtPersonInCharge" runat="server" Text='<%#Bind("PersonInCharge") %>'
                                                Enabled="false"></asp:TextBox>
                                        </td>
                                        <td align="right">
                                            <asp:Label ID="lblOrganizationTel" runat="server" meta:resourcekey="lblOrganizationTel"></asp:Label>
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtOrganizationTel" runat="server" Text='<%#Bind("OrganizationTel") %>'
                                                Enabled="false"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="lblLocation" runat="server" meta:resourcekey="lblLocation"></asp:Label>
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtLocation" runat="server" MaxLength="50" Text='<%#Bind("Location") %>'
                                                Enabled="false"></asp:TextBox>
                                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtLocation"
                                                Display="None" meta:resourcekey="rfvLocation" SetFocusOnError="True" ValidationGroup="vInsert"></asp:RequiredFieldValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="lblDateSpan" runat="server" meta:resourcekey="lblDateSpan"></asp:Label>
                                        </td>
                                        <td align="left">
                                            <My:CalendarTextBox ID="txtStartDate" runat="server" Text='<%#Bind("StartDate") %>' />
                                            <asp:CompareValidator ID="chk_txtStartDate" runat="server" ControlToValidate="txtStartDate"
                                                Display="None" meta:resourcekey="chk_txtStartDate2" Operator="DataTypeCheck"
                                                Type="Date" ValidationGroup="vInsert"></asp:CompareValidator>
                                            ~
                                            <My:CalendarTextBox ID="txtEndDate" runat="server" Text='<%#Bind("EndDate") %>' />
                                            <asp:CompareValidator ID="chk_txtEndDate" runat="server" ControlToValidate="txtEndDate"
                                                Display="None" meta:resourcekey="chk_txtEndDate2" Operator="DataTypeCheck" Type="Date"
                                                ValidationGroup="vInsert"></asp:CompareValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">
                                            <asp:Panel ID="PanelRegionType" runat="server" meta:resourcekey="PanelRegionType">
                                                <My:SelfRegionType ID="SelfRegionType1" runat="server" />
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="right">
                                            <asp:Label ID="lblComment" runat="server" meta:resourcekey="lblComment"></asp:Label>
                                        </td>
                                        <td align="left" colspan="3">
                                            <asp:TextBox ID="txtComment" MaxLength="150" Width="400" Text='<%#Bind("Location") %>'
                                                runat="server" TextMode="MultiLine" Rows="4"></asp:TextBox>
                                        </td>
                                    </tr>
                                </table>
                                <asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="BulletList"
                                    ShowMessageBox="false" ShowSummary="true" ValidationGroup="vInsert" />
                            </EditItemTemplate>
                        </asp:FormView>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td class="Section">
            <asp:Label ID="lblLeaderInfo" runat="server" meta:resourcekey="lblLeaderInfo"></asp:Label></td>
    </tr>
    <tr>
        <td align="center">
            <My:AddLeader ID="AddLeader1" runat="server" ValidationGroup="AddWorkHeaderA" />
        </td>
    </tr>
    <asp:PlaceHolder ID="plCleanResult" runat="server">
        <tr>
            <td class="Section">
                <asp:Label ID="lblCleanResult" runat="server" meta:resourcekey="lblCleanResult"></asp:Label></td>
        </tr>
        <tr align="center">
            <td>
                <My:AddWorkHeaderControl ID="AddWorkHeaderControl1" runat="server" />
                <br />
            </td>
        </tr>
    </asp:PlaceHolder>
    <tr>
        <td align="center">
            <br />
        </td>
    </tr>
    <tr>
        <td class="Section">
            <asp:Label ID="lblVolunteerList" runat="server" meta:resourcekey="lblVolunteerList"></asp:Label>
        </td>
    </tr>
</table>
<div align="center">
    <table>
        <tr>
            <td>
                <uc4:VolunteerQueryControl ID="VolunteerQueryControl1" runat="server" />
            </td>
            <td valign="bottom">
                <asp:Button ID="btnQuery" runat="server" Text="<%$ Resources:Query %>" />
            </td>
        </tr>
    </table>
</div>
<hr />
<div align="right">
    <asp:Label ID="lblDefaultWorkHour" runat="server" Text="<%$ Resources:DefaultWorkHour %>"></asp:Label>
    <asp:TextBox ID="txtDefaultWorkHour" runat="server" MaxLength="7" Width="60px" Text="0"></asp:TextBox>
    <asp:RequiredFieldValidator ID="chk_txtDefaultWorkHour" runat="server" ErrorMessage="<%$ Resources:chk_txtDefaultWorkHour %>"
        ControlToValidate="txtDefaultWorkHour" Display="None" ValidationGroup="ShowPersonA"></asp:RequiredFieldValidator>
    <asp:RangeValidator ID="chk_txtDefaultWorkHour2" runat="server" ErrorMessage="<%$ Resources:chk_txtDefaultWorkHour2 %>"
        Display="None" MaximumValue="999.999" MinimumValue="0.000" Type="Double" ValidationGroup="ShowPersonA"
        ControlToValidate="txtDefaultWorkHour"></asp:RangeValidator>
    <asp:PlaceHolder ID="plVolunteerCondition" runat="server" Visible="false">
        <asp:Label ID="lblDefaultWorkTimes" runat="server" Text="<%$ Resources:DefaultWorkTimes %>"></asp:Label>
        <asp:TextBox ID="txtDefaultWorkTimes" runat="server" MaxLength="5" Width="60px" Height="19px"
            Text="1"></asp:TextBox>
        <asp:RequiredFieldValidator ID="chk_txtDefaultWorkTimes" runat="server" ErrorMessage="<%$ Resources:chk_txtDefaultWorkTimes %>"
            ControlToValidate="txtDefaultWorkTimes" Display="None" ValidationGroup="ShowPersonA"></asp:RequiredFieldValidator>
        <asp:RangeValidator ID="chk_txtDefaultWorkTimes2" runat="server" ErrorMessage="<%$ Resources:chk_txtDefaultWorkTimes2 %>"
            ControlToValidate="txtDefaultWorkTimes" Display="None" MaximumValue="99999" MinimumValue="0"
            Type="Integer" ValidationGroup="ShowPersonA"></asp:RangeValidator>
    </asp:PlaceHolder>
    <asp:Button ID="btnUpdateHour" runat="server" meta:resourcekey="btnUpdateHour" ValidationGroup="ShowPersonA" CommandName="btnUpdateHour" />
    <ajaxToolkit:ConfirmButtonExtender ID="cbUpdateHour" runat="server" TargetControlID="btnUpdateHour" meta:resourcekey="cbUpdateHour"></ajaxToolkit:ConfirmButtonExtender>
<asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
    <asp:Button ID="btnUpdate" runat="server" Text="<%$ Resources:Update %>" />
    <asp:Button ID="btnDelete" runat="server" Text="<%$ Resources:Delete %>" />
    <asp:Button ID="btnShowPerson" runat="server" Text="<%$ Resources:ShowPerson %>"
        ValidationGroup="ShowPersonA" />
    </ContentTemplate>
</asp:UpdatePanel>
</div>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
       <div id="Table1" align=center style="OVERFLOW: auto; HEIGHT: 300px">
        <table width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <td align="right"><asp:Label ID="lblTotal" runat="server"></asp:Label></td>
           </tr>
           <tr>
                <td>
                    <My:MyGridView ID="GridView_Volunteers" runat="server" AllowHoverEffect="False" AllowHoverSelect="False"
                        AllowPaging="false" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="RecordID"
                        MySortDirection="Ascending" SkinID="pager" meta:resourcekey="gv">
                        <Columns>
                            <asp:TemplateField HeaderText="<%$ Resources:VOrganizationName %>" SortExpression="VOrganizationName">
                                <itemtemplate>
                                    <%#Eval("VOrganizationName") %>
                                </itemtemplate>
                            </asp:TemplateField>
                            <My:VolunteerIDBoundField DataField="VolunteerID" HeaderText="<%$ Resources:VolunteerID %>"
                            ReadOnly="True" /> 
                            <asp:BoundField DataField="VolunteerName" HeaderText="<%$ Resources:VolunteerName %>"
                                SortExpression="VolunteerName" ReadOnly="True" />
                            <asp:TemplateField HeaderText="<%$ Resources:WorkHour %>" SortExpression="WorkHour">
                                <itemtemplate>
                                    <asp:TextBox ID="txtWorkHour" runat="server" MaxLength="7" 
                                        Text='<%# Bind("WorkHour") %>' ValidationGroup="EditWorkRecord" Width="60px"></asp:TextBox>
                                    <asp:RangeValidator ID="chk_txtWorkHour" runat="server" 
                                        ControlToValidate="txtWorkHour" Display="None" 
                                        ErrorMessage="<%$ Resources:chk_txtWorkHour %>" MaximumValue="999.999" 
                                        MinimumValue="0.000" ValidationGroup="EditWorkRecord"></asp:RangeValidator>
                                </itemtemplate>
                                <itemstyle width="60px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="<%$ Resources:WorkTimes %>" SortExpression="WorkTimes"
                                Visible="false">
                                <itemtemplate>
                                    <asp:TextBox ID="txtWorkTimes" runat="server" MaxLength="5" 
                                        Text='<%# Bind("WorkTimes") %>' ValidationGroup="EditWorkRecord" Width="60px"></asp:TextBox>
                                    <asp:RangeValidator ID="chk_txtWorkTimes" runat="server" 
                                        ControlToValidate="txtWorkTimes" Display="None" 
                                        ErrorMessage="<%$ Resources:chk_txtWorkTimes %>" MaximumValue="99999999" 
                                        MinimumValue="0" ValidationGroup="EditWorkRecord"></asp:RangeValidator>
                                </itemtemplate>
                                <itemstyle width="60px" />
                            </asp:TemplateField>  
                            <asp:TemplateField   Visible="false">
                                <itemtemplate>
                                    <asp:LinkButton ID="lbtnUpdate" runat="server" CommandName="Update" 
                                        Text="<%$ Resources:Update %>" ValidationGroup="EditWorkRecord"></asp:LinkButton>
                                </itemtemplate>
                                <edititemtemplate>
                                    &nbsp;
                                </edititemtemplate>
                                <itemstyle horizontalalign="Center" width="80px" />
                            </asp:TemplateField>
                   <%--         <asp:TemplateField ShowHeader="False">
                                <itemtemplate>
                                    <asp:LinkButton ID="lbtnDelete" runat="server" CausesValidation="False" CommandName="Delete"
                                        Text="<%$ Resources:Delete %>" 
                                        onclientclick="<%$ Resources:ConfirmDelete %>"></asp:LinkButton>
                                </itemtemplate>
                                <itemstyle horizontalalign="Center" />
                            </asp:TemplateField>--%>
                            <asp:TemplateField  meta:resourcekey="bfdelete">
                                 <headertemplate>
                                    <asp:Label ID="bfdelete" runat="server" Text="<%$ Resources:bfdelete.HeaderText %>"></asp:Label>
                                    <asp:CheckBox ID="chkAlldelete" runat="server" OnCheckedChanged="chkAlldelete_CheckedChanged"
                                        AutoPostBack="true"></asp:CheckBox>
                                </headertemplate>
                                <itemtemplate>
                                    <asp:CheckBox ID="chkdelete" runat="server"></asp:CheckBox>
                                </itemtemplate>
                                <itemstyle horizontalalign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField meta:resourcekey="bfSignIn">
                                <headertemplate>
                                    <asp:Label ID="bfSignIn" runat="server" Text="<%$ Resources:bfSignIn.HeaderText %>"></asp:Label>
                                    <asp:CheckBox ID="chkAllSignIn" runat="server" OnCheckedChanged="chkAllSignIn_CheckedChanged"
                                        AutoPostBack="true" Checked="true"></asp:CheckBox>
                                </headertemplate>
                                <itemtemplate>
                                    <asp:CheckBox ID="chkSignIn" runat="server"></asp:CheckBox>
                                </itemtemplate>
                                <itemstyle horizontalalign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField meta:resourcekey="bfSignOut">
                                <headertemplate>
                                    <asp:Label ID="bfSignOut" runat="server" Text="<%$ Resources:bfSignOut.HeaderText %>"></asp:Label>
                                    <asp:CheckBox ID="chkAllSignOut" runat="server" OnCheckedChanged="chkAllSignOut_CheckedChanged"
                                        AutoPostBack="true" Checked="true"></asp:CheckBox>
                                </headertemplate>
                                <itemtemplate>
                                    <asp:CheckBox ID="chkSignOut" runat="server"></asp:CheckBox>
                                </itemtemplate>
                                <itemstyle horizontalalign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="<%$ Resources:Status %>" Visible="false">
                                <itemtemplate>
                                    <asp:CheckBoxList ID="cblCheckStatus" runat="server" OnDataBinding="cblCheckStatus_DataBinding"
                                        RepeatDirection="Horizontal">
                                        <asp:ListItem>簽到</asp:ListItem>
                                        <asp:ListItem>簽退</asp:ListItem>
                                    </asp:CheckBoxList>
                                </itemtemplate>
                            </asp:TemplateField>
                        </Columns>
                    </My:MyGridView>
                </td>
            </tr>
        </table>
       </div>
    </ContentTemplate>
</asp:UpdatePanel>

<uc1:SearchVolunteerControl_AddCleanPlan ID="SearchVolunteerControl_AddCleanPlan1"
    runat="server" />
